package com.googlecode.garbagecan.test.rhino;

import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;

public class SimpleEmbeddedJavaScript {
	public static void main(String[] args) {
		Context cx = Context.enter();

		try {
			Scriptable scope = cx.initStandardObjects();
			String script = "var s = 'Hello, Rhino'; s;";
			Object obj = cx.evaluateString(scope, script, "TestScript", 1, null);
			System.out.println("Object: " + obj);
			System.out.println(cx.toString(obj));
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			Context.exit();
		}
	}
}
